package com.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dao.ModelNameDao;
import com.domain.ModelName;

@Service
public class ModelNameService {
	@Autowired
	private ModelNameDao modelNameDao;
	
	public List<ModelName> getAllNames(){
		
		return modelNameDao.getAllModelNames();
	}
	public void saveModelName(ModelName modelName){
		
		modelNameDao.saveModelName(modelName);
	}
	public boolean isExist(ModelName modelName){
		int result = modelNameDao.checkExist(modelName);
		if(result>0){
			return true;
		}
		return false;
	}
	public void updateModelName(String oldName,String newName){
		modelNameDao.updateModelName(newName, oldName);
	}
	public void delModelName(ModelName modelName){
		
		modelNameDao.delModelName(modelName);
	}
}